<!DOCTYPE html>
<table id="list2"></table>
<div id="pager2"></div>

<script type="text/javascript">
var options={
		url : 'course/list',
		caption : '课程列表',
		//width: '100%',
		editurl: 'course/edit',
		autowidth: true,
		height : 500,
		hidegrid: false,
		datatype : 'json',
		mtype : 'post',
		rowNum : 10,
		rowList : [10,20,50],
		prmNames: {search:"search"},
		sortname : 'id',
		viewrecords : true,
		pager : '#pager2',
		jsonReader : { 
			 repeatitems: false,
			 id : 'id'
		},
		colModel:[
			{label:'id',name:'id',index:'id',align:'center',sortable:true,width:50,sorttype:'int',search:false},
			{label:'课程名称',name:'name',index:'name',align:'center',sortable:true,width:100,editable:true,sorttype:'text'},
			{label:'课时数',name:'classHours',index:'classHours',align:'center',sortable:true,width:80,editable:true,editrules:{required:true,integer:true},sorttype:'int'}
		]
	}
	$(function(){
		$('#list2').jqGrid(options);
		$("#list2").jqGrid('navGrid','#pager2',{edit:true,add:true,del:true},{
			left:200,
			top:50,
			closeAfterEdit:true,
			closeOnEscape:true,
			savekey:[true,13]
		},{
			left:200,
			top:50,
			beforeSubmit: function (postData,formid){
				postData.id='';
				return [true,'ok'];
			},
			closeAfterAdd:true,
			closeOnEscape:true,
			savekey:[true,13]
		},{
			left:200,
			top:50,
			closeOnEscape:true
			
		},{
			left:200,
			top:50,
			closeAfterSearch:true,
			closeAftreReset:true,
			closeOnEscape:true,
			multipleSearch:true
		});
	});

</script>
